package com.xiaotu.spider.baidu.pipeline;

import org.springframework.stereotype.Component;

import com.xiaotu.common.model.DieStarModel;
import com.xiaotu.common.util.Constants;
import com.xiaotu.common.util.DataRedisKeyUtils;
import com.xiaotu.spider.APipeline;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;

@Component("StarBaiduBaikePipeline")
public class StarBaiduBaikePipeline extends APipeline
{
    @Override
    protected void doProcess(ResultItems resultItems, Task task)
    {
        DieStarModel dieModel = resultItems.get(DieStarModel.class.getName());
        if (dieModel == null)
            return;
        
        String key = DataRedisKeyUtils.getKey(Constants.DataRedisKey.Star_BaiDu_BaiKe);
		cacheHandler.hSet(key, dieModel.getStarId(), dieModel);
    }

}
